package day03;
//算术运算符的演示
public class OperDemo1 {
    public static void main(String[] args) {
        //1)算术运算符:+、-、*、/、%、++、--


        /*
        int a=5,b=5;
        a++; //相当于a=a+1
        ++b; //相当于b=b+1
        System.out.println(a); //6
        System.out.println(b); //6
        */
        /*
        int a=5,b=5;
        int c = a++; //将a++的值5赋值给c，同时a自增1变为6
        int d = ++b; //将++b的值6赋值给d，同时b自增1变为6
        System.out.println(a); //6
        System.out.println(b); //6
        System.out.println(c); //5
        System.out.println(d); //6
        */

        /*
        int a=5,b=5;
        a--; //相当于a=a-1
        --b; //相当于b=b-1
        System.out.println(a); //4
        System.out.println(b); //4
         */
        int a=5,b=5;
        int c = a--; //将a--的值5赋值给c，同时a自减1变为4
        int d = --b; //将--b的值4赋值给d，同时b自减1变为4
        System.out.println(a); //4
        System.out.println(b); //4
        System.out.println(c); //5
        System.out.println(d); //4

        /*
        System.out.println(5%2); //1，商2余1
        System.out.println(8%2); //0，商4余0----整除
        System.out.println(2%8); //2，商0余2
        System.out.println(0%7); //0，商0余0
        */
    }
}












